﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/TemplateUser.Master" Inherits="System.Web.Mvc.ViewPage" %>
<%@import Namespace="ManageBanking.Models" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	 <script src="../../Scripts/jquery.validate.js" type="text/javascript"></script>

    <script src="../../Scripts/functions.js" type="text/javascript"></script>

    <script src="../../Scripts/wysiwyg.js" type="text/javascript"></script>
    <link href="../../Content/css/SucErr1.css" rel="stylesheet" type="text/css" />
    
    <script src="../../Scripts/jquery-ui-1.8.2.custom.min.js" type="text/javascript"></script>
	
	<script type="text/javascript">
	    $(function() {
	    $("#IdUsername").autocomplete({
	            source: '/Admin/ManageUserAdmin/CompleteUser',
	            minLength: 1

	        });
	    });
</script>

    <style type="text/css">
      
        .green

        {
            float:left;
            color: Green;
            margin-left:218px;
            margin-top:-9px;
        }

        .red

        {   float:left;
            margin-left:218px;
            color: Red;
            margin-top:-9px;
        }
        #divcheck
        {
        float:left;
        margin-left:14px;
        margin-top:-9px;	
        }
        .btnCheck
        {
        margin-left:11px;	
        	
        }
    </style>
    <script type="text/javascript">
        $(document).ready(function() {
            $("#money").keyup(function() {
                var status = $("#divcheckmoney");
                status.html("");
                
                $('#e').attr("value", 0);

            });
            $("#money").blur(function() {

                var name = $("#money").val();
                var name1 = $("#ttmoney").val();

                var status = $("#divcheckmoney");

                status.html("Checking....").removeClass(); ;

                $.post("/T_Account/CheckMoney1", { money: name },

                    function(data) {

                        if (data == true) {

                            status.html("Money is Valid!!!!!!").addClass("green");
                           
                            $('#e').attr("value", 1);
                           
                            

                        } else {

                            status.html("Money Is Invalid!!!!!!").addClass("red");
                           
                            $('#e').attr("value", 0);
                        }

                    });

            });

        });
   
   
   </script>  
    <script type="text/javascript">

        $(document).ready(function() {
            var a = 0;
            var e = 0;
            $("#IdUsername").keyup(function() {
                var status = $("#divcheck");
                status.html("");
                $("#a").attr("value", 0);
            });
            $("#Check").click(function() {

                var name = $("#IdUsername").val();

                var status = $("#divcheck");

                status.html("Checking....").removeClass(); ;

                $.post("/Admin/ManageUserAdmin/CheckNameUser", { username: name },

                    function(data) {

                        if (data == true) {

                            status.html("Username is not available!").addClass("red");
                            $("#a").attr("value", 0);

                        } else {

                            status.html("Username is  available!").addClass("green");
                            $("#a").attr("value", 1);
                        }

                    });

            });

            $('#f1').submit(function() {
                a = $('#a').attr("value");
                e = $('#e').attr("value");
                alert(e);
                if (a == 0) {

                    alert("Please Check Username,Or Username not valid");
                    return false;

                }
                else if (e == 0) {
                    alert("Please Check Money, or Money Is Invalid");
                    return false;

                }
                if (a == 1 && e == 1) {

                    return true;
                }
                return false;
            });


        });
    </script>

</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

 
 <div class="center_block_top"><span>&nbsp;</span><h3>Registry Account</h3></div>
<div class="center_block_mau"><!--section-->
	<div id="intro">
        <blockquote>
        <% if (ViewData["Check"] == "true")
     {
                  %>
         <div class="succes">
					<div class="succes_icon"><!-- --></div>
					<a href="#" class="close" title="Close this notification">x</a>
					<div class="desc">
						<span>Success!</span>
						<p>Success,Your Action Is Success!!!</p>
					</div>
				</div>
				<div class="clear"><!-- --></div>   
				<%} %>
				<%else if (ViewData["Check"] != null)
    { %>
				<div class="err">
					<div class="err_icon"><!-- --></div>
					<a href="#" class="close" title="Close this notification">x</a>
					<div class="desc">
						<span>Error!</span>
						<p><%=ViewData["Check"]%></p>
					</div>
				</div>
				<%} %>
        <div class="redistry">
  		<%using (Html.BeginForm("ResolveAddAccount", "Cashier", FormMethod.Post, new { @id = "f1" }))
      { %>
  		<ul>
        	<li>
            	<span>Username:</span>
            	<div class="input_text"></div>
            	<div><input name="IdUsername" type="text" id="IdUsername" size="20" /></div>
            	<div class="check1">
            	<a id="Check" href="#"> Check</a>
                </div>
            <div id="divcheck" class="error" visible="true"></div> 	
           </li>
            <li>
            	<span>Type Account:</span>
            	<div>
            	    <select class="combobox-addacc" name="IdType">
            	        <% foreach (TypeAccount tac in (List<TypeAccount>)ViewData["listtypeacc"])
                        {%>
            	        <option class="option-addacc" value='<%= tac.IdType %>' ><%= tac.TypeName%></option>
            	        <% } %>
            	    </select>
            	</div></li>
              <input id="a" type="hidden" value="0" />
           
            	
          
            <!-- button -->
             <li >
            	<span>Money Deposit:</span>
            	<div class="input_text" ></div>
            	<div ><input name="money" id="money" type="text" size="20" /></div>
                   <input id="e" type="hidden" value="0" />
    <div id="divcheckmoney" class="error" visible="true"></div>
    </li>  
            <li>
            
            
            	<span>&nbsp;</span>
                <ul>
                	<li ><input type="submit" name="button" value="OK" class="ok"/></li>
                    <li id="cancel" ><input type="reset" name="button" value="Reset" class="ok" /></li>
                </ul>
            </li>
        </ul>
        <%} %>
  </div>
  
</blockquote>
<div class="clearBoth"></div>

</div>
<!--//intro-->
</div>
    <div class="center_block_bottom_mau"></div>
   
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolderScript" runat="server">


</asp:Content>
